//    Copyright (C) Kherty.  All rights reserved.
using OpenLS.Core;

namespace OpenLS.Spreadsheet
{
    class DeleteRowUndoUnit: IUndoUnit
    {
        public DeleteRowUndoUnit(DimensionCollection<Row> owner, Row row)
        {
            Owner = owner;
            Row = row;
        }

        readonly Row Row;
        readonly DimensionCollection<Row> Owner;
        #region IUndoUnit Members

        public void Do()
        {
            Owner.InsertAt(Row, Row.Index);
            foreach (Cell cell in Row.GetNonEmptyCells())
            {
                Row.Worksheet.NonVolatileCells.AddNoRow(cell);
            }
        }

        public bool Merge(IUndoUnit unit)
        {
            return false;
        }

        #endregion
    }
}
